#ifndef DIRECTED_GRAPH_H
#define DIRECTED_GRAPH_H

#include "edge.h"
#include "node.h"

#include <QtCore/QHash>
#include <QtCore/QPair>
#include <QtCore/QSet>

namespace core
{

class DirectedGraph
{
public:
    DirectedGraph(bool handleMemory = true);
    ~DirectedGraph();

    Edge* connect(Node* from, Node* to, IEdgeData* data = 0);
    void disconnect(Node*& from, Node*& to);

    bool removeNode(Node* node);

    QSet<Node* > getNodes() const;
    Edge* getEdge(Node* from, Node* to) const;

    void clear();

private:
    bool m_handleMemory;
    QSet<Node* > m_nodes;
    QHash<QPair<Node*, Node* >, Edge* > m_edges;
};

} // namespace core

#endif
